﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.Serialization;
using System.Windows.Forms;

namespace CXMLStudioIDE.Common.EntityProperties
{
    [Serializable()]
    public class MyBinding : ISerializable
    {
        #region Declarations

        private string _PropertyName;
        private string _DataSource;
        private string _DataMember;

        #endregion

        #region Public Properties
        public string PropertyName
        {
            get { return _PropertyName; }
            set { _PropertyName = value; }
        }

        public string DataSource
        {
            get { return _DataSource; }
            set { _DataSource = value; }
        }

        public string DataMember
        {
            get { return _DataMember; }
            set { _DataMember = value; }
        }
        #endregion

        #region Constructors

        public MyBinding()
        {
        }

        public MyBinding(SerializationInfo info, StreamingContext ctxt)
        {
            this._PropertyName = (string)info.GetValue("PropertyName", typeof(string));
            this._DataSource = (string)info.GetValue("DataSource", typeof(string));
            this._DataMember = (string)info.GetValue("DataMember", typeof(int));
        }
        #endregion

        #region Methods

        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("PropertyName", this._PropertyName);
            info.AddValue("DataSource", this._DataSource);
            info.AddValue("DataMember", this._DataMember);
        }

        #endregion
    }
}
